@model ShivamEMR.Model.Domain.ContactsDomain.Address

@* This partial view defines form fields that will appear when creating and editing entities *@

<div class="editor-label">
    @Html.LabelFor(model => model.Address1)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Address1)
    @Html.ValidationMessageFor(model => model.Address1)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.Address2)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Address2)
    @Html.ValidationMessageFor(model => model.Address2)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.Landmark)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Landmark)
    @Html.ValidationMessageFor(model => model.Landmark)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.ZipCode)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.ZipCode)
    @Html.ValidationMessageFor(model => model.ZipCode)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.Notes)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Notes)
    @Html.ValidationMessageFor(model => model.Notes)
</div>

<div class="editor-label">
    AddressType
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.AddressTypeID, ((IEnumerable<ShivamEMR.Model.Domain.ContactsDomain.AddressType>)ViewBag.PossibleAddressTypes).Select(option => new SelectListItem {
        Text = Html.DisplayTextFor(_ => option).ToString(), 
        Value = option.ID.ToString(),
        Selected = (Model != null) && (option.ID == Model.AddressTypeID)
    }), "Choose...")
    @Html.ValidationMessageFor(model => model.AddressTypeID)
</div>
<div class="editor-label">
    City
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.CityID, ((IEnumerable<ShivamEMR.Model.Domain.ContactsDomain.City>)ViewBag.PossibleCities).Select(option => new SelectListItem {
        Text = Html.DisplayTextFor(_ => option).ToString(), 
        Value = option.ID.ToString(),
        Selected = (Model != null) && (option.ID == Model.CityID)
    }), "Choose...")
    @Html.ValidationMessageFor(model => model.CityID)
</div>
<div class="editor-label">
    Territory
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.TerritoryID, ((IEnumerable<ShivamEMR.Model.Domain.ContactsDomain.Territory>)ViewBag.PossibleTerritories).Select(option => new SelectListItem {
        Text = Html.DisplayTextFor(_ => option).ToString(), 
        Value = option.ID.ToString(),
        Selected = (Model != null) && (option.ID == Model.TerritoryID)
    }), "Choose...")
    @Html.ValidationMessageFor(model => model.TerritoryID)
</div>
<div class="editor-label">
    Country
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.CountryID, ((IEnumerable<ShivamEMR.Model.Domain.ContactsDomain.Country>)ViewBag.PossibleCountries).Select(option => new SelectListItem {
        Text = Html.DisplayTextFor(_ => option).ToString(), 
        Value = option.ID.ToString(),
        Selected = (Model != null) && (option.ID == Model.CountryID)
    }), "Choose...")
    @Html.ValidationMessageFor(model => model.CountryID)
</div>
<div class="editor-label">
    Company
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.CompanyID, ((IEnumerable<ShivamEMR.Model.Domain.CompanyDomain.Company>)ViewBag.PossibleCompanies).Select(option => new SelectListItem {
        Text = (option == null ? "None" : option.Name), 
        Value = option.ID.ToString(),
        Selected = (Model != null) && (option.ID == Model.CompanyID)
    }), "Choose...")
    @Html.ValidationMessageFor(model => model.CompanyID)
</div>
<div class="editor-label">
    Branch
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.BranchID, ((IEnumerable<ShivamEMR.Model.Domain.CompanyDomain.Branch>)ViewBag.PossibleBranches).Select(option => new SelectListItem {
        Text = (option == null ? "None" : option.Name), 
        Value = option.ID.ToString(),
        Selected = (Model != null) && (option.ID == Model.BranchID)
    }), "Choose...")
    @Html.ValidationMessageFor(model => model.BranchID)
</div>
